using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vwrenumbatchMap : EntityTypeConfiguration<vwrenumbatch>
    {
        public vwrenumbatchMap()
        {
            // Primary Key
            this.HasKey(t => new { t.id, t.oldbatch, t.newbatch, t.COMPANY });

            // Properties
            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.oldbatch)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.newbatch)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.period)
                .HasMaxLength(4);

            this.Property(t => t.File_Primary_Key)
                .HasMaxLength(10);

            this.Property(t => t.COMPANY)
                .IsRequired()
                .HasMaxLength(33);

            // Table & Column Mappings
            this.ToTable("vwrenumbatch");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.oldbatch).HasColumnName("oldbatch");
            this.Property(t => t.newbatch).HasColumnName("newbatch");
            this.Property(t => t.period).HasColumnName("period");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");
            this.Property(t => t.COMPANY).HasColumnName("COMPANY");
        }
    }
}
